import { strictEqual } from "assert";
import { ArrayPlus } from "../src/Engine/Core/ArrayPlus";
import { describe, it } from "@jest/globals";

describe("ArrayPlus", () => {
  const arr = [1, 2, 3, 4, 5];
  const arrayPlus = new ArrayPlus(arr);

  it("should have the correct value", () => {
    strictEqual(arrayPlus.value, arr);
  });

  it("should be able to push a new item", () => {
    arrayPlus.push(6);
    strictEqual(arrayPlus.value.length, 6);
    strictEqual(arrayPlus.value[5], 6);
  });

  it("should be able to remove an item by value", () => {
    arrayPlus.remove(3);
    strictEqual(arrayPlus.value.length, 5);
    strictEqual(arrayPlus.value.indexOf(3), -1);
  });

  it("should be able to dropRight", () => {
    arrayPlus.dropRight(2);
    strictEqual(arrayPlus.value.length, 3);
    strictEqual(arrayPlus.value[2], 4);
  });

  it("should be able to empty the array", () => {
    arrayPlus.empty();
    strictEqual(arrayPlus.value.length, 0);
  });
});
